﻿using System;
using System.Collections.Generic;
using System.IO;

class Solution
{
    /* Head ends here */
    static void displayPathtoPrincess(int n, String[] grid)
    {
        int im = 0, jm = 0, ip = 0, jp = 0;
        for (int i = 0; i < grid.Length; ++i)
        {
            for (int j = 0; j < grid[i].Length; ++j)
            {
                switch (grid[i][j])
                {
                    case 'm':
                        im = i; jm = j;
                        break;
                    case 'p':
                        ip = i; jp = j;
                        break;
                }
            }
        }
        string si = "DOWN", sj = "RIGHT";
        if (im > ip)
        {
            si = "UP";
            int temp = im; im = ip; ip = temp;
        }
        if (jm > jp)
        {
            sj = "LEFT";
            int temp = jm; jm = jp; jp = temp;
        }
        for (int i = im; i < ip; ++i)
            Console.WriteLine(si);
        for (int j = jm; j < jp; ++j)
            Console.WriteLine(sj);
    }
    /* Tail starts here */
    static void Main(String[] args)
    {
        int m;

        m = int.Parse(Console.ReadLine());

        String[] grid = new String[m];
        for (int i = 0; i < m; i++)
        {
            grid[i] = Console.ReadLine();
        }

        displayPathtoPrincess(m, grid);

        //Console.ReadKey();
    }
}